package com.example.nacosconfiga.config;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Component
@RefreshScope // 给这个类上添加一个刷新的作用域
public class Hero {
    @Value("${hero.name}")
    private String name;

    @Value("${hero.age}")
    private Long age;

    @Value("${hero.address}")
    private String address;
}
